﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Threading.Tasks;
using CPPEI.ETL.WebApp;
using Quartz;
using Quartz.Impl;

namespace CPPEI.ETL.WebApp
{
    public class JobHelper
    {
        private static IScheduler _scheduler;
        public static async void Init()
        {
            StdSchedulerFactory factory = new StdSchedulerFactory();
            _scheduler = factory.GetScheduler();
            _scheduler.Start();
            IJobDetail job = JobBuilder.Create<TestSmsJob>()
                .Build();
            ICronTrigger trigger = (ICronTrigger)TriggerBuilder.Create()
                .WithCronSchedule(ConfigurationManager.AppSettings["TestCfg"])
                .Build();
            //加入作业调度池中
            _scheduler.ScheduleJob(job, trigger);

        }

    }
}
